<?
require("config.php");
require("bin/encoding.php");
include("bin/class.Chinese.php");
$codeTablesDir = "./bin/encoding/";

function flashencode($str){
  $str=eregi_replace("&","%26",$str);
  //$str=urlEncode($str);
  return $str;
}



//$CharEncoding=new Encoding(); 
//$CharEncoding->SetGetEncoding("BIG5")||die("Encode Error!"); 
//$CharEncoding->SetToEncoding("UTF-8")||die("Encode Error!"); 


function conv($str){
//	global $CharEncoding;
//	return $CharEncoding->EncodeString($str); 
global $codeTablesDir;
$chs = new Chinese("BIG5","UTF8",$str,$codeTablesDir);
return $chs->ConvertIT();
}


$table = "med_announcement";

$field = array(

"id",
"subject",
"details",
"picture",

);

$r = limitQuery($table,$field,$exp);

for($i=0;$i<count($r);$i++){
	
	$ids  = $ids . "~@:_" . $r[$i][0];
	$names  = $names . "~@:_" . $r[$i][1];
	$details  = $details . "~@:_" . $r[$i][2];
	$pictures  = $pictures . "~@:_" . $r[$i][3];

}

print("&ids="  . substr($ids,4));
print("&names="  . conv(substr($names,4)));
//print("&details="  . conv(substr($details,4)));
print("&pictures="  . flashencode(substr($pictures,4)));
print("&pic_dir=../pictures_tw/" . $table . "/");
print("&readinfo=true");

?>